package com.syni.mdd.yhd.common.all.service;

import org.springframework.stereotype.Service;

/**
 * @className
 * @description TOO
 * @Author cfx
 * @DATE 2019/4/9 12:04
 * @VERSION 1.0
 **/
@Service
public class BmsBrushService{

    /*public Map<String, Object> doCommentNum() {
        List<BmsUser> bmsUsers = getVirtualUser();
        if(!(bmsUsers != null && bmsUsers.size() > 0)){
            return ResultMapHelper.failure("缺失模拟用户,无法刷取");
        }
        Integer pageNum = 1;
        Integer pageSize = 1000;
        String[] videoLikeTypes = videoLikeType.split(",");
        Set videoLikeTypesSet = new HashSet(Arrays.asList(videoLikeTypes));
        List<BmsDxComment> bmsDxComments = new LinkedList<>();
        for(int ii = pageNum;;ii++) {
            Pageable pageable = BmsCommonService.getPageable(ii, pageSize);
            Page<BmsVideo> bmsVideos = bmsVideoService.getBaseDao().findAll(new Specification<BmsVideo>() {
                @Override
                public Predicate toPredicate(Root<BmsVideo> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
                    Map<String,Object> searchMap = new HashMap<String,Object>(){{
                        put("isRelease", Constants.COMMON_FLAG_FALSE);
                        put("isDelete",Constants.COMMON_FLAG_FALSE);
                        put("isOff",Constants.COMMON_FLAG_FALSE_INT);
                        put("fromOrigins",videoLikeTypesSet);
                    }};
                    criteriaQuery.where(bmsVideoService.structureSqlBuild(root,criteriaBuilder,searchMap));
                    return null;
                }
            },pageable);
            List<BmsVideo> bmsVideoList = bmsVideos.getContent();
            if(!(bmsVideoList != null && bmsVideoList.size() > 0)){
                break;
            }
            int count = 0;
            for(BmsVideo bmsVideo : bmsVideoList){
                BmsDxComment bmsDxComment = new BmsDxComment();
                bmsDxComment.setBmsVideoId(bmsVideo.getId());
                int takeUserIndex = (int)(Math.random() * (bmsUsers.size()));
                bmsDxComment.setBmsUserId(bmsUsers.get(takeUserIndex).getId());
                bmsDxComment.setContent("a");
                bmsDxComment.setNewTime(new Date());
                bmsDxComment.setFromOrigin(Constants.USER_CLIENT);
                bmsDxComments.add(bmsDxComment);
                if(count == 1){
                    break;
                }
                count++;
            }
        }
        bmsDxCommentService.getBaseDao().saveAll(bmsDxComments);
        return ResultMapHelper.success("评论刷取成功！");
    }*/
}
